import paramiko
import time

def cisco(ipt,usernamet,passwordt):
    ssh1=paramiko.SSHClient()
    ssh1.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh1.connect(hostname=ipt,port=22,username=usernamet,password=passwordt,timeout=5,\
                 allow_agent=False,look_for_keys=False)
    cli_connect=ssh1.invoke_shell()
    cli_connect.send('enable\n')
    time.sleep(1)
    g = cli_connect.recv(99999).decode()
    # print(g)
    cli_connect.send('qytang\n')
    time.sleep(1)
    g = cli_connect.recv(99999).decode()
    # print(g)
    cli_connect.send('terminal length 0\n')
    time.sleep(1)
    g = cli_connect.recv(99999).decode()
    # print(g)
    cli_connect.send('show run\n')
    time.sleep(1)
    run_config=cli_connect.recv(99999).decode()
    time.sleep(1)
    ssh1.close()
    return run_config

def huawei(ipt,usernamet,passwordt):
    ssh1=paramiko.SSHClient()
    ssh1.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh1.connect(hostname=ipt,port=22,username=usernamet,password=passwordt,timeout=5,\
                 allow_agent=False,look_for_keys=False)
    cli_connect=ssh1.invoke_shell()
    cli_connect.send('screen-length 0 temporary\n')
    time.sleep(1)
    cli_connect.send('dis cur\n')
    time.sleep(1)
    run_config=cli_connect.recv(99999).decode()
    time.sleep(1)
    ssh1.close()
    return run_config
